package com.wondersgroup.aida.tools;

import dev.langchain4j.model.chat.ChatLanguageModel;
import dev.langchain4j.model.openai.OpenAiChatModel;
import dev.langchain4j.model.zhipu.ZhipuAiChatModel;

import java.time.Duration;

/**
 * @author: 紫麒麟vip
 * @create: 2025/2/15
 * Description:
 */
public class ModelUtil {

    public static final String API_KEY_ZHIPU ="64966600c51bf974cc69c2ca477db41d";
    public static final String API_KEY_0PENAI="sk-Qxt1e040220a75c18e3a2193f6b5cb0d8fb718b7ff3UxxI1";
    public static final String BASE_URI_OPENAI ="https://api.gptsapi.net/v1";

    public static ChatLanguageModel getOpenAIMOdel(){
        return OpenAiChatModel.builder()
                .baseUrl(ModelUtil.BASE_URI_OPENAI)
                .apiKey(ModelUtil.API_KEY_0PENAI)
//                .modelName(OpenAIChatModelName.GPT_4_O_MINI)
                .build();
    }

    public static ChatLanguageModel getZhipuAIModel(){
        return ZhipuAiChatModel.builder()
                .apiKey(ModelUtil.API_KEY_ZHIPU)
//                .model(ChatCompletionModel.GLM_4_FLASH)
                // 调用超时时间
                .callTimeout(Duration.ofSeconds(10))
                // 连接超时时间（必须设置）
                .connectTimeout(Duration.ofSeconds(10))
                // 必须设置
                .writeTimeout(Duration.ofSeconds(10))
                // 必须设置
                .readTimeout(Duration.ofSeconds(10))
                .build();
    }
}
